package core.tool.htmlparser.samples;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class ScrubSelectedWeb {
	private final static String CRLF = System.getProperty("line.separator");

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			URL ur = new URL("http://www.google.cn/");
			InputStream instr = ur.openStream();
			String s, str;
			BufferedReader in = new BufferedReader(new InputStreamReader(instr));
			StringBuffer sb = new StringBuffer();
			BufferedWriter out = new BufferedWriter(new FileWriter(
					"E:/outPut.txt"));
			while ((s = in.readLine()) != null) {
				sb.append(s + CRLF);
			}
			System.out.println(sb);
			str = new String(sb);
			out.write(str);
			out.close();
			in.close();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}

